package a.j;

import a.c.d;
import a.c.k;
import a.c.m;
import a.c.n;
import a.f.cd;
import a.f.ed;
import a.f.o;
import a.f.r;
import a.f.vc;
import a.f.zb;
import a.f.zc;
import a.i.p;
import a.j.a.j;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;

public class kd
{
  public static final Object a = "y.view.NodePortLayoutConfigurator#EDGE2D_DPKEY";
  private boolean b;
  private boolean c = true;
  private boolean d = true;
  private k e;
  private k f;
  private k g;
  private k h;
  private boolean i;
  private boolean j;
  private static final ld k = e();
  public static boolean l;
  
  public boolean a()
  {
    return this.b;
  }
  
  public void a(boolean paramBoolean)
  {
    this.b = paramBoolean;
  }
  
  public boolean b()
  {
    return this.c;
  }
  
  public void b(boolean paramBoolean)
  {
    this.c = paramBoolean;
  }
  
  public boolean c()
  {
    return this.d;
  }
  
  public void c(boolean paramBoolean)
  {
    this.d = paramBoolean;
  }
  
  public void a(g paramg)
  {
    boolean bool = ld.E;
    if (!bool)
    {
      if (a()) {
        e(paramg);
      }
      if (bool) {}
    }
    else if (b())
    {
      d(paramg);
    }
    c(paramg);
  }
  
  private void c(g paramg)
  {
    p local2 = new p()
    {
      public Object get(Object paramAnonymousObject)
      {
        return paramAnonymousObject;
      }
    };
    paramg.j(a);
    paramg.a(a, local2);
  }
  
  protected void d(g paramg)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    n localn1 = paramg.C();
    n localn2 = paramg.C();
    this.i = false;
    Object localObject = paramg.v();
    label60:
    label61:
    label74:
    do
    {
      if (!((a.c.w)localObject).e()) {
        break;
      }
      ld localld = paramg.w(((a.c.w)localObject).d());
      if (bool1) {
        break label292;
      }
      if (localld.y() > 0)
      {
        Iterator localIterator = localld.z();
        do
        {
          if (!localIterator.hasNext()) {
            break label271;
          }
          jd localjd = (jd)localIterator.next();
          m localm1 = localjd.d();
          if (!bool2) {
            if (localm1.k() > 1)
            {
              do
              {
                if (!localm1.e()) {
                  break;
                }
                localn2.a(localm1.a(), localjd);
                if (bool2) {
                  break label181;
                }
                localm1.f();
                if (bool1) {
                  break label176;
                }
              } while (!bool1);
              if (bool2) {
                break label289;
              }
            }
          }
          do
          {
            this.i = true;
            m localm2 = localjd.e();
            if (localm2.k() <= 1) {
              break label74;
            }
            if (bool2) {
              break label61;
            }
            if (bool1) {
              break;
            }
            if (localm2.e())
            {
              localn1.a(localm2.a(), localjd);
              localm2.f();
              if (bool2) {
                break label263;
              }
              if (bool1) {
                break label261;
              }
              if (!bool1) {
                break label60;
              }
            }
          } while (bool2);
          this.i = true;
          if (bool2) {
            break label280;
          }
        } while (!bool1);
      }
      ((a.c.w)localObject).f();
    } while (!bool1);
    label176:
    label181:
    if (!bool2)
    {
      if (this.i)
      {
        localObject = ed.c;
        this.g = paramg.c(localObject);
      }
    }
    else
    {
      if (!bool2)
      {
        if (this.g != null) {
          paramg.j(localObject);
        }
        paramg.a(localObject, localn1);
        localObject = ed.d;
        this.h = paramg.c(localObject);
        if (bool2) {}
      }
      else
      {
        if (this.h != null) {
          paramg.j(localObject);
        }
        paramg.a(localObject, localn2);
      }
      return;
    }
    label261:
    label263:
    label271:
    label280:
    label289:
    label292:
    paramg.a(localn1);
    paramg.a(localn2);
  }
  
  protected void e(g paramg)
  {
    boolean bool3 = ld.E;
    boolean bool2 = ld.D;
    n localn1 = paramg.C();
    n localn2 = paramg.C();
    boolean bool1 = false;
    j localj = paramg.K();
    int m = localj != null ? 1 : 0;
    if (!bool3) {}
    int n = !c() ? 1 : 0;
    Object localObject = paramg.w();
    label206:
    label207:
    do
    {
      do
      {
        if (!((m)localObject).e()) {
          break;
        }
        d locald = ((m)localObject).a();
        jd localjd1 = jd.a(paramg, locald, true);
        if (bool3) {
          break label376;
        }
        if (bool2) {
          break label364;
        }
        if (localjd1 != null)
        {
          if (((bool3) || (n != 0)) && ((bool3) || (m != 0))) {
            if (!bool3)
            {
              if (localj.m(locald.e())) {
                localn1.a(locald, cd.a(a(localjd1)));
              }
            }
            else
            {
              if (bool3) {
                break label207;
              }
              if (!bool2) {
                break label206;
              }
            }
          }
          paramg.t(locald).a(jd.c(localjd1));
          localn1.a(locald, cd.a(a(localjd1), true));
          bool1 = true;
        }
        jd localjd2 = jd.a(paramg, locald, false);
        if (!bool3)
        {
          if (localjd2 != null)
          {
            if (((bool3) || (n != 0)) && ((bool3) || (m != 0))) {
              if (!bool3)
              {
                if (localj.m(locald.f())) {
                  localn2.a(locald, cd.a(a(localjd2)));
                }
              }
              else
              {
                if (bool3) {
                  break label326;
                }
                if (!bool2) {
                  break label325;
                }
              }
            }
            paramg.t(locald).b(jd.c(localjd2));
            localn2.a(locald, cd.a(a(localjd2), true));
            bool1 = true;
          }
          ((m)localObject).f();
        }
      } while (!bool2);
      this.j = bool1;
      if (bool3) {
        break label449;
      }
    } while (bool3);
    label325:
    label326:
    if (bool1)
    {
      label364:
      localObject = ed.a;
      this.e = paramg.c(localObject);
      label376:
      if (!bool3)
      {
        if (this.e != null) {
          paramg.j(localObject);
        }
        paramg.a(localObject, localn1);
        localObject = ed.b;
        this.f = paramg.c(localObject);
        if (bool3) {}
      }
      else
      {
        if (this.f != null) {
          paramg.j(localObject);
        }
        paramg.a(localObject, localn2);
      }
    }
    else
    {
      paramg.a(localn1);
      paramg.a(localn2);
    }
    label449:
  }
  
  protected byte a(jd paramjd)
  {
    boolean bool = ld.E;
    a.d.w localw = paramjd.h();
    ld localld = paramjd.b();
    double d1 = localld.A();
    double d2 = localld.B();
    double d3 = localld.c();
    double d4 = localld.d();
    double d5 = d3 * 0.25D;
    double d6 = d4 * 0.25D;
    if (!bool) {
      if (d1 - d5 <= localw.a())
      {
        if (bool) {
          break label130;
        }
        if (localw.a() <= d1 + d5)
        {
          if (bool) {
            break label130;
          }
          if (d2 - d6 <= localw.b())
          {
            if (bool) {
              break label130;
            }
            if (localw.b() <= d2 + d6) {
              return 0;
            }
          }
        }
      }
    }
    label130:
    byte b1 = 0;
    double d7 = (1.0D / 0.0D);
    double d8 = localld.a();
    double d9 = localld.b();
    double d10 = Math.abs(d9 - localw.b());
    if (!bool)
    {
      if (d7 > d10)
      {
        d7 = d10;
        b1 = 1;
      }
      d10 = Math.abs(d9 + d4 - localw.b());
    }
    if (!bool)
    {
      if (d7 > d10)
      {
        d7 = d10;
        b1 = 2;
      }
      d10 = Math.abs(d8 - localw.a());
    }
    if (!bool)
    {
      if (d7 > d10)
      {
        d7 = d10;
        b1 = 8;
      }
      d10 = Math.abs(d8 + d3 - localw.a());
    }
    if (!bool) {
      if (d7 > d10)
      {
        d7 = d10;
        b1 = 4;
      }
    }
    return b1;
  }
  
  public void f(g paramg)
  {
    boolean bool = ld.E;
    g(paramg);
    if (!bool) {
      if (a())
      {
        i(paramg);
        if (bool) {
          break label48;
        }
        if (!ld.D) {
          break label40;
        }
      }
    }
    j(paramg);
    label40:
    if ((bool) || (b())) {
      label48:
      h(paramg);
    }
  }
  
  private void g(g paramg)
  {
    paramg.j(a);
  }
  
  protected void h(g paramg)
  {
    boolean bool = ld.E;
    if ((bool) || (this.i))
    {
      Object localObject = ed.c;
      k localk1 = paramg.c(localObject);
      if (!bool) {
        if (localk1 != null)
        {
          paramg.j(localObject);
          if (bool) {
            break label65;
          }
          if ((localk1 instanceof n)) {
            paramg.a((n)localk1);
          }
        }
      }
      label65:
      if (!bool)
      {
        if (this.g != null)
        {
          paramg.a(localObject, this.g);
          this.g = null;
        }
        localObject = ed.d;
      }
      k localk2 = paramg.c(localObject);
      if (!bool)
      {
        if (localk2 != null)
        {
          paramg.j(localObject);
          if (bool) {
            break label144;
          }
          if ((localk2 instanceof n)) {
            paramg.a((n)localk2);
          }
        }
        if (bool) {
          break label157;
        }
      }
      if (this.h != null)
      {
        label144:
        paramg.a(localObject, this.h);
        label157:
        this.h = null;
      }
    }
  }
  
  protected void i(g paramg)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    if ((bool2) || (this.j))
    {
      Object localObject1 = ed.a;
      k localk1 = paramg.c(localObject1);
      localObject1 = ed.b;
      k localk2 = paramg.c(localObject1);
      m localm = paramg.w();
      label150:
      do
      {
        if (!localm.e()) {
          break;
        }
        d locald = localm.a();
        tb localtb = paramg.t(locald);
        jd localjd = jd.a(paramg, locald, true);
        if (bool2) {
          break label227;
        }
        if (bool1) {
          break label226;
        }
        if (localjd != null) {
          if (a(localk1, locald))
          {
            if (bool2) {
              break label150;
            }
            localObject2 = jd.c(localjd);
            localtb.a((a.d.w)localObject2);
            if (!bool1) {}
          }
          else
          {
            jd.a(localjd, localtb.c());
          }
        }
        Object localObject2 = jd.a(paramg, locald, false);
        if (!bool2)
        {
          if (localObject2 != null) {
            if (a(localk2, locald))
            {
              a.d.w localw = jd.c((jd)localObject2);
              localtb.b(localw);
              if (bool2) {
                continue;
              }
              if (!bool1) {}
            }
            else
            {
              jd.a((jd)localObject2, localtb.d());
            }
          }
          localm.f();
        }
      } while (!bool1);
      if (!bool2) {
        label226:
        localObject1 = ed.a;
      }
      label227:
      if (!bool2) {
        if (localk1 != null)
        {
          paramg.j(localObject1);
          if (bool2) {
            break label265;
          }
          if ((localk1 instanceof n)) {
            paramg.a((n)localk1);
          }
        }
      }
      label265:
      if (!bool2)
      {
        if (this.e != null)
        {
          paramg.a(localObject1, this.e);
          this.e = null;
        }
        localObject1 = ed.b;
      }
      if (!bool2)
      {
        if (localk2 != null) {
          paramg.j(localObject1);
        }
      }
      else
      {
        if (!bool2)
        {
          if ((localk2 instanceof n)) {
            paramg.a((n)localk2);
          }
          if (bool2) {}
        }
        else
        {
          if (this.f == null) {
            return;
          }
          paramg.a(localObject1, this.f);
        }
        this.f = null;
      }
    }
  }
  
  protected void j(g paramg)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    a.c.w localw = paramg.v();
    label104:
    label106:
    do
    {
      do
      {
        if (!localw.e()) {
          return;
        }
        ld localld = paramg.w(localw.d());
        if ((bool2) || (localld.y() > 0))
        {
          Iterator localIterator = localld.z();
          do
          {
            if (!localIterator.hasNext()) {
              break;
            }
            a(paramg, (jd)localIterator.next());
            if (bool2) {
              break label106;
            }
            if (bool1) {
              break label104;
            }
          } while (!bool1);
        }
      } while (bool2);
      localw.f();
    } while (!bool1);
  }
  
  private void a(g paramg, jd paramjd)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    m localm = paramjd.c();
    if (localm.e())
    {
      Object localObject1 = null;
      Object localObject2 = null;
      label83:
      do
      {
        if (!localm.e()) {
          break;
        }
        localObject3 = localm.a();
        if (bool1) {
          break label101;
        }
        if (!bool2)
        {
          if (((d)localObject3).g()) {
            localObject1 = localObject3;
          }
        }
        else
        {
          if (bool2) {
            continue;
          }
          if (!bool1) {
            break label83;
          }
        }
        localObject2 = localObject3;
        localm.f();
      } while (!bool1);
      label101:
      Object localObject3 = (!bool2) && (localObject2 == null) ? paramg.t(localObject1) : paramg.t(localObject2);
      if (!bool2) {
        if (jd.b((tb)localObject3) == paramjd)
        {
          if (bool2) {
            break label159;
          }
          jd.a(paramjd, ((tb)localObject3).c());
        }
      }
      label159:
      if ((bool1) && ((bool2) || (jd.d((tb)localObject3) == paramjd))) {
        jd.a(paramjd, ((tb)localObject3).d());
      }
    }
  }
  
  public vc d()
  {
    return new b_(null);
  }
  
  private static boolean a(k paramk, d paramd)
  {
    boolean bool = ld.E;
    if (!bool) {
      if (paramk == null) {
        return false;
      }
    }
    Object localObject = paramk.get(paramd);
    if (!bool) {
      if (localObject == null) {
        return false;
      }
    }
    return ((cd)localObject).a();
  }
  
  private static ld e()
  {
    md localmd = new md();
    localmd.a(0.0D, 0.0D);
    localmd.a(null);
    localmd.b(null);
    localmd.c(null);
    while (localmd.x() > 0) {
      localmd.c(localmd.b(0));
    }
    localmd.a(new jd());
    return localmd;
  }
  
  private static final class a_
  {
    private final Collection a = new ArrayList(1);
    private final Collection c = new ArrayList(1);
    private a.d.w e = a.d.w.c;
    private boolean f = true;
    
    void a(d paramd)
    {
      this.a.add(paramd);
      this.f &= paramd.g();
    }
    
    Iterator a()
    {
      return this.a.iterator();
    }
    
    void b(d paramd)
    {
      this.c.add(paramd);
      this.f &= paramd.g();
    }
    
    Iterator b()
    {
      return this.c.iterator();
    }
    
    boolean c()
    {
      boolean bool = ld.E;
      if ((bool) || (this.a.isEmpty())) {
        if (bool) {}
      }
      return this.c.isEmpty();
    }
    
    boolean d()
    {
      return this.f;
    }
    
    a.d.w f()
    {
      return this.e;
    }
    
    void a(a.d.w paramw)
    {
      this.e = paramw;
    }
  }
  
  private final class b_
    extends r
  {
    private b_() {}
    
    public boolean canLayout(o paramo)
    {
      return b(paramo);
    }
    
    public void doLayout(o paramo)
    {
      boolean bool = ld.E;
      a(paramo);
      if (!bool) {
        if (kd.this.a())
        {
          if (bool) {
            break label40;
          }
          c(paramo);
          if (!ld.D) {
            return;
          }
        }
      }
      label40:
      d(paramo);
    }
    
    private void c(o paramo)
    {
      boolean bool2 = ld.E;
      boolean bool1 = ld.D;
      Object localObject1 = kd.a;
      k localk1 = paramo.c(localObject1);
      localObject1 = ed.a;
      k localk2 = paramo.c(localObject1);
      localObject1 = ed.b;
      k localk3 = paramo.c(localObject1);
      if ((localk1 != null) && ((bool2) || (paramo.m() > 0)))
      {
        g localg = (g)((d)localk1.get(paramo.q())).c();
        md localmd = new md(kd.k);
        jd localjd1 = localmd.c(0);
        m localm = paramo.w();
        label273:
        do
        {
          if (!localm.e()) {
            break;
          }
          d locald1 = localm.a();
          d locald2 = (d)localk1.get(locald1);
          jd localjd2 = jd.a(localg, locald2, true);
          Object localObject3;
          Object localObject4;
          if (!bool2) {
            if ((localjd2 != null) && (kd.a(localk2, locald1)))
            {
              localObject2 = paramo.d(locald1.e());
              localmd.a(((zc)localObject2).a(), ((zc)localObject2).b(), ((zc)localObject2).c(), ((zc)localObject2).d());
              localjd1.a(localjd2.g());
              if (bool2) {
                break label273;
              }
              localObject3 = jd.c(localjd1);
              localObject4 = paramo.e(locald1);
              if (!((a.d.w)localObject3).equals(((zb)localObject4).c())) {
                ((zb)localObject4).a((a.d.w)localObject3);
              }
            }
          }
          Object localObject2 = jd.a(localg, locald2, false);
          if (!bool2)
          {
            if (localObject2 != null)
            {
              if (bool2) {
                continue;
              }
              if (kd.a(localk3, locald1))
              {
                localObject3 = paramo.d(locald1.f());
                localmd.a(((zc)localObject3).a(), ((zc)localObject3).b(), ((zc)localObject3).c(), ((zc)localObject3).d());
                localjd1.a(((jd)localObject2).g());
                localObject4 = jd.c(localjd1);
                zb localzb = paramo.e(locald1);
                if (bool2) {
                  continue;
                }
                if (!((a.d.w)localObject4).equals(localzb.d())) {
                  localzb.b((a.d.w)localObject4);
                }
              }
            }
            localm.f();
          }
        } while (!bool1);
      }
    }
    
    private void d(o paramo)
    {
      boolean bool2 = ld.E;
      boolean bool1 = ld.D;
      Object localObject1 = kd.a;
      k localk = paramo.c(localObject1);
      if ((localk != null) && ((bool2) || (paramo.m() > 0)))
      {
        g localg = (g)((d)localk.get(paramo.q())).c();
        md localmd = new md(kd.k);
        jd localjd = localmd.c(0);
        HashMap localHashMap = new HashMap();
        Object localObject2 = paramo.w();
        Object localObject3;
        Object localObject4;
        Object localObject5;
        Object localObject6;
        label310:
        label312:
        label498:
        label500:
        do
        {
          if (!((m)localObject2).e()) {
            break;
          }
          localObject3 = ((m)localObject2).a();
          localObject4 = (d)localk.get(localObject3);
          localObject5 = jd.a(localg, (d)localObject4, true);
          if (bool1) {
            return;
          }
          Object localObject7;
          Object localObject8;
          if (!bool2) {
            if (localObject5 != null)
            {
              localObject6 = (kd.a_)localHashMap.get(localObject5);
              if (!bool2) {
                if (localObject6 == null)
                {
                  localObject6 = new kd.a_();
                  localHashMap.put(localObject5, localObject6);
                }
              }
              if (!bool2)
              {
                if (!((kd.a_)localObject6).c()) {
                  if (bool2) {
                    break label312;
                  }
                }
              }
              else
              {
                if (!((kd.a_)localObject6).d()) {
                  break label310;
                }
                if (((d)localObject3).g()) {
                  break label310;
                }
              }
              localObject7 = paramo.d(((d)localObject3).e());
              localmd.a(((zc)localObject7).a(), ((zc)localObject7).b(), ((zc)localObject7).c(), ((zc)localObject7).d());
              localObject8 = ((jd)localObject5).g().a();
              localjd.a(((de)localObject8).a(localmd, paramo.r((d)localObject3)));
              ((kd.a_)localObject6).a(jd.c(localjd));
              ((kd.a_)localObject6).b((d)localObject3);
            }
          }
          localObject6 = jd.a(localg, (d)localObject4, false);
          if (!bool2)
          {
            if (localObject6 != null)
            {
              localObject7 = (kd.a_)localHashMap.get(localObject6);
              if (!bool2) {
                if (localObject7 == null)
                {
                  localObject7 = new kd.a_();
                  localHashMap.put(localObject6, localObject7);
                }
              }
              if (!bool2)
              {
                if (!((kd.a_)localObject7).c()) {
                  if (bool2) {
                    break label500;
                  }
                }
              }
              else
              {
                if (!((kd.a_)localObject7).d()) {
                  break label498;
                }
                if (((d)localObject3).g()) {
                  break label498;
                }
              }
              localObject8 = paramo.d(((d)localObject3).f());
              localmd.a(((zc)localObject8).a(), ((zc)localObject8).b(), ((zc)localObject8).c(), ((zc)localObject8).d());
              de localde = ((jd)localObject6).g().a();
              localjd.a(localde.a(localmd, paramo.s((d)localObject3)));
              ((kd.a_)localObject7).a(jd.c(localjd));
              ((kd.a_)localObject7).a((d)localObject3);
            }
            ((m)localObject2).f();
          }
        } while (!bool1);
        if (!bool2)
        {
          localObject2 = localHashMap.values().iterator();
          label632:
          label639:
          do
          {
            while (!((Iterator)localObject4).hasNext())
            {
              if (!((Iterator)localObject2).hasNext()) {
                break;
              }
              localObject3 = (kd.a_)((Iterator)localObject2).next();
              localObject4 = ((kd.a_)localObject3).a();
              do
              {
                do
                {
                  if (!((Iterator)localObject4).hasNext()) {
                    break;
                  }
                  localObject5 = (d)((Iterator)localObject4).next();
                  localObject6 = paramo.e(localObject5);
                  ((zb)localObject6).b(((kd.a_)localObject3).f());
                  if (bool2) {
                    break label639;
                  }
                  if (bool1) {
                    break label632;
                  }
                } while (!bool1);
              } while (bool2);
              localObject4 = ((kd.a_)localObject3).b();
            }
            localObject5 = (d)((Iterator)localObject4).next();
            localObject6 = paramo.e(localObject5);
            ((zb)localObject6).a(((kd.a_)localObject3).f());
          } while ((!bool2) && ((!bool1) && (!bool1)));
        }
      }
    }
    
    b_(kd.2 param2)
    {
      this();
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.kd

 * JD-Core Version:    0.7.0.1

 */